package com.garlicts.framework.common;

import com.garlicts.framework.core.FrameworkConstant;
import com.garlicts.framework.config.PropertiesProvider;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class IpUtil {

    public static String getLocalIp(){
        try {
            InetAddress ia = InetAddress.getLocalHost();
            String port = PropertiesProvider.getString(FrameworkConstant.CUSTOM_RPC_PORT);
            return ia.getHostAddress() + ":" + port;
        } catch (UnknownHostException e) {
            e.printStackTrace();
            return null;
        }

    }

    public static void main(String[] args) {
        System.out.println(getLocalIp());
    }

}
